package com.srd.phone.activity;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.shengrongdai.srd.R;
import com.srd.phone.application.BaseApplication;
import com.srd.phone.utils.UserUtils;

/**
 * 信息披露
 */
public class MessagePublishActivity extends BaseActivity implements  View.OnClickListener {

    private TextView tv_version_num;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_publish);

        initView();
        initData();
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    public void initView() {
        tv_common_title.setText("信息披露");
        findViewById(R.id.rl_about).setOnClickListener(this);
        findViewById(R.id.rl_prevention_control).setOnClickListener(this);
        findViewById(R.id.rl_related_products).setOnClickListener(this);
        findViewById(R.id.rl_app_grade).setOnClickListener(this);
        findViewById(R.id.btn_logout).setOnClickListener(this);

        tv_version_num = (TextView)findViewById(R.id.tv_version_num);
    }

    public void initData() {
        super.initData();

        String versionName = ((BaseApplication)getApplication()).getVersionName();
        tv_version_num.setText("V" + versionName);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(mContext,StaticPageActivity.class);
        switch (v.getId()) {
            case R.id.rl_about:  // 关于
                intent.putExtra("flag", 2);
                startActivity(intent);
                break;
            case R.id.rl_prevention_control:  // 防控
                intent.putExtra("flag",1);
                startActivity(intent);
                break;
            case R.id.rl_related_products:  // 相关产品

                break;
            case R.id.rl_app_grade:  // 应用评分

                break;

            case R.id.btn_logout:
                UserUtils.deleteUserInfo();
                gotoActivity(MainActivity.class);
                finish();
                break;
        }
    }

}